unit UnitCadCalculoComissao;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UnitCadModelo, StdCtrls, ComCtrls, Buttons, ExtCtrls, Grids,
  DBGrids, SMDBGrid, Mask, DBCtrls, DB, jpeg;

type
  TFormCadCalculoComissao = class(TFormCadModelo)
    Panel1: TPanel;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    SMDBGrid1: TSMDBGrid;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btCancelarClick(Sender: TObject);
    procedure btOKClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormCadCalculoComissao: TFormCadCalculoComissao;

implementation

uses UnitCalculoComissao;

{$R *.dfm}

procedure TFormCadCalculoComissao.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  FormCadCalculoComissao := nil;
end;

procedure TFormCadCalculoComissao.btCancelarClick(Sender: TObject);
begin
  inherited;
  with FormCalculoComissao do
  begin
    if qryDados.State in [dsInsert,dsEdit] then
      qryDados.Cancel;
    if qryItens.State in [dsInsert,dsEdit] then
      qryItens.Cancel;
  end;
end;

procedure TFormCadCalculoComissao.btOKClick(Sender: TObject);
begin
  inherited;
  with FormCalculoComissao do
  begin
    if qryDados.State in [dsInsert,dsEdit] then
      qryDados.Post;
    if qryItens.State in [dsInsert,dsEdit] then
      qryItens.Post;
  end;
end;

end.
